using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input.Touch;
using BlueGameComponent;

namespace AirForce
{
    class CreditsScreen : MenuScreen
    {
        string credits = "Gel Studio\nDesigner Blue\nPrograming Blue\nArtist Blue\nBlue-1986@hotmail.com";
        float OffsetY = 0;
        Texture2D background;

        public CreditsScreen()
            : base("Credits")
        {
            //IsPopup = true;
            EnabledGestures = GestureType.Tap;
            OffsetY = 0;
        }
        public override void LoadContent()
        {
            base.LoadContent();
            background = ScreenManager.Game.Content.Load<Texture2D>("Textures/mainMenu");
        }
        public override void HandleInput(InputState input)
        {
            base.HandleInput(input);
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }

            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                this.ExitScreen();
            }

            if (!IsActive)
            {
                return;
            }

            // Return to the main menu when a tap gesture is recognized
            if (input.Gestures.Count > 0)
            {
                GestureSample sample = input.Gestures[0];
                if (sample.GestureType == GestureType.Tap)
                {
                    this.ExitScreen();

                    input.Gestures.Clear();
                }
            }
        }

        public override void Draw(GameTime gameTime)
        {
            
            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
            spriteBatch.Begin();
            DrawTransition(background, new Vector2(0, 0), Color.White);
            if (IsActive)
            {
                spriteBatch.DrawString(ScreenManager.Font, credits, new Vector2(100, ScreenManager.ViewPort.Height - OffsetY)+new Vector2(2,2), Color.Gray);
                spriteBatch.DrawString(ScreenManager.Font, credits, new Vector2(100, ScreenManager.ViewPort.Height - OffsetY), Color.BlueViolet);
            }
            spriteBatch.End();
            base.Draw(gameTime);
        }
        public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
        {
            base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
            if (IsActive)
            {
                OffsetY += 1.0f;
            }
            
        }
    }
}
